#include<disp_manager.h>
#include<stdlib.h>

int main(int argc, char** argv)
{
	int led_x;
	int led_y;
	PDispBuffer ptBuffer;
	int FontSize;
	char *str = "www.armelle.com";
	FontBitMap tFontBitMap;
	int ret;
	int i = 0;

	if (argc != 5)
	{
		printf("Usage: %s <font_file> <lcd_x> <lcd_y> <font_size>\n", argv[0]);
		return -1;
	}

	led_x = atoi(argv[2]);
	led_y = atoi(argv[3]);
	FontSize = atoi(argv[4]);
	
	DisplaySystemRegister();
	SelectDefaultDisplay("fb");

	InitDefaultDisplay();
	ptBuffer = GetDisplayBuffer();

	FontSymstemRegister();
	ret = SelectAndInitFont("freetype", argv[1]);
	if(ret)
	{
		printf("SelectAndInitFont err \n");
	}
	
	SetFontSize(FontSize);

	tFontBitMap.iCurOriginX = led_x;
	tFontBitMap.iCurOriginY = led_y;
	
	while(str[i])
	{
		GetFontBitMap(str[i], &tFontBitMap); 
		
		/* draw on buffer */
		DrawFontBitMap(&tFontBitMap, 0xffff);

		FlushDisplayRegion(&tFontBitMap.tRegion, ptBuffer);
			
		tFontBitMap.iCurOriginX = tFontBitMap.iNextOriginX;
		tFontBitMap.iCurOriginY = tFontBitMap.iNextOriginY;

		i++;
	}
	 
	return 0;
}


